package com.example.guitarforme.activity

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.example.activity.LoginAct
import com.example.guitarforme.R
import com.example.guitarforme.databinding.ActFlashBinding

class FlashAct : AppCompatActivity() {

    private var isHasSkip :Boolean = false

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // 使用 DataBindingUtil 设置布局
        val binding: ActFlashBinding = DataBindingUtil.setContentView(this, R.layout.act_flash)

//        // 延迟5秒后跳转到HomeAct
        Handler(Looper.getMainLooper()).postDelayed({
            if (!isHasSkip){
                val intent = Intent(this, LoginAct::class.java)
                startActivity(intent)
                finish() // 关闭启动页
            }
        }, 3000)

        binding.actFlashSkip.setOnClickListener {
            isHasSkip = true
            val intent = Intent(this, LoginAct::class.java)
            startActivity(intent)
            finish() // 关闭启动页

        }
    }

}